#pragma once

class CMainFrame;
class CVividArtistView;
class CVividDraw
{
public:
	CVividDraw(CVividArtistView* pView);
	~CVividDraw(void);

	void Main();
	void End();

	BOOL callFileDialog(CString* fileName);
	BOOL callCAMDialog(CString* fileName);

	BOOL setImageOrigin();

	BOOL savePencilImage();
	BOOL saveCharcoalImage();
	BOOL saveLineImage();
	BOOL saveBasicImage(CProgressCtrl* pProgress);

	BOOL drawPencilImage(HDC hDC);
	BOOL drawCharcoalImage(HDC hDC);
	BOOL drawLineImage(HDC hDC);
	BOOL drawBasicImage(CProgressCtrl* pProgress, HDC hDC);

	void endBasicImage();
	void endPencilImage();
	void endCharcoalImage();
	void endLineImage();

	void initControl();
	void resetControl(CProgressCtrl* pProgress, LPCTSTR str, IplImage* image = NULL);

	BOOL saveView(CBitmap* pBmp, CPalette* pPal);
	BOOL printImage();
	BOOL saveImage();

	HANDLE DDBToDIB(CDC* pDC, CBitmap &Bitmap, CPalette *pPal);
	BOOL WriteDIB(TCHAR* pszFileName, HANDLE hDIB);

private:
	CVividArtistView* m_pView;
	CDC*  m_pDC;
	
	Point m_viewOrg;
	IplImage* m_pOrigin;
	int m_nLoad, m_nOption, m_nSpeed;
	BOOL m_bFindEye;
};
